Skip to content

Only enable host check if you use proxy, and add a way to opt out of it - #2288

Merged
gaearon merged 2 commits into
react:masterfrom
gaearon:disable-host-check
May 20, 2017
Merged

gaearon merged 2 commits into
react:masterfrom
gaearon:disable-host-check

Conversation

@gaearon

@gaearon gaearon commented May 20, 2017 •

Copy link
Copy Markdown
Contributor

The newly added host check (webpack/webpack-dev-server#887, explanation) is significantly disruptive to people’s workflows (#2271, #2233), especially in legit use cases like cloud editors (#2271 (comment)).

I think only enabling the host check for proxy users is a reasonable compromise because unlike WDS, we only serve files in public folder by default which the user has consented to... being public. Of course, with proxy enabled this is still dangerous, so we enable the host check in this case.

For people who use proxy with a non-localhost development server, we recommend specifying the HOST in .env.development file. It gets passed as the public option to WDS. This solves the problem nicely for most remaining cases.

Finally, this adds a way to completely opt out of the host checks by adding DANGEROUSLY_DISABLE_HOST_CHECK=true to .env.development.local in case you are not worried about attacks (which could be the case if you’re using a cloud editor and don’t have sensitive data) and just can’t get it to work otherwise.

@gaearon

ghost commented May 20, 2017

Copy link
Copy Markdown
Contributor Author

@edmorley @sokra

Any chance you could take a glance at this? I know it’s not perfect, but the alternative is that people just "eject" from Create React App to modify their configs, at which point they're just as unsafe.

So while this doesn't quite solve the public folder issue I see it as a reasonable compromise.

@gaearon
gaearon merged commit ba0d0da into react:master May 20, 2017
@gaearon
gaearon deleted the disable-host-check branch May 20, 2017 17:34
@edmorley

ghost commented May 24, 2017

Copy link
Copy Markdown

Hi! This looks like a good compromise - great idea :-)

@gaearon

ghost commented May 24, 2017

Copy link
Copy Markdown
Contributor Author

@edmorley Thanks for checking!

@gaearon gaearon mentioned this pull request Oct 31, 2017
@lock lock Bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants